package com.itheima.exception;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo02 {

    public static void main(String[] args)  {

        method1();
       // method2();


    }


    //运行期异常
    //抛出异常  把异常抛出给调用者
    public static void method1() throws NullPointerException {
        String s=null;
        System.out.println(s.length());
    }

    //编译期异常
    //抛出以上
    public static void method2() throws ParseException {
            String s="1991-10-01";
            Date date = new SimpleDateFormat("yyyy/MM/dd").parse(s);


    }
}
